#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
/* add 3 head file */
#include <QtCharts>
#include <QChartView>
#include <QSplineSeries>

QT_BEGIN_NAMESPACE
namespace Ui {
class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private:
    Ui::Widget *ui;
    /* creat chart */
    QChart* mChart;
    QChartView* chartView;
    QDateTimeAxis* axis_x;

    QDateTime minTime_min;
    QDateTime minTime_max;
    QDateTime maxTime_max;
    QDateTime maxTime_min;

    void wheelEvent(QWheelEvent *event);
    void mousePressEvent(QMouseEvent *event);
    double findNearestY(double xVal);
};
#endif // WIDGET_H
